﻿Public Class Point
    Private _highScore As String
    Private _CowTotals As Integer
    Private _ChickenTotals As Integer
    Private _KilledTotals As Integer
    Private _passedText As String
    Dim xHighScore As Integer
    Public Property [PassedText]() As String
        Get
            Return _passedText
        End Get
        Set(ByVal Value As String)
            _passedText = Value
        End Set
    End Property
    Public Property [HighScore]() As String
        Get
            Return _highScore
        End Get
        Set(ByVal Value As String)
            _highScore = Value
        End Set
    End Property
    Public Property [xcowtotal]() As Integer
        Get
            Return _CowTotals
        End Get
        Set(ByVal Value As Integer)
            _CowTotals = Value
        End Set
    End Property
    Public Property [xchickentotal]() As Integer
        Get
            Return _ChickenTotals
        End Get
        Set(ByVal Value As Integer)
            _ChickenTotals = Value
        End Set
    End Property
    Public Property [Killeds]() As Integer
        Get
            Return _KilledTotals
        End Get
        Set(ByVal Value As Integer)
            _KilledTotals = Value
        End Set
    End Property

    Private Sub Point_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        InitializeComponent()
        Dim x As New Home
        GameForm.Controls.Clear()
        GameForm.Controls.Add(x)
        GameForm.Show()
    End Sub

    Private Sub Point_Load(sender As Object, e As EventArgs) Handles Me.Load
        GamePoint.Text = PassedText
        Dim xHighScorelength As Integer
        xHighScorelength = HighScore.Length
        ChickenTotal.Text = xchickentotal * 100
        CowTotal.Text = xcowtotal * 100
        Killed.Text = Killeds * 1000
        Dim sHighScore As String
        sHighScore = HighScore.Replace(" ", "")
        xHighScore = Convert.ToInt64(sHighScore.Substring(13, sHighScore.Length() - 13))

        Dim totalpoint As Integer
        totalpoint = Convert.ToInt64(GamePoint.Text) + Convert.ToInt64(CowTotal.Text) + Convert.ToInt64(ChickenTotal.Text) + Convert.ToInt64(Killed.Text)
        If totalpoint > xHighScore Then
            LblHighScore.Visible = True
            System.IO.File.WriteAllText("HighestScore.txt", totalpoint)
        End If
        FinalScore.Text = totalpoint
    End Sub

    Private Sub BtnPlayAgain_Click(sender As Object, e As EventArgs) Handles BtnPlayAgain.Click
        Me.Close()
        InitializeComponent()
        Dim x As New Main
        GameForm.Controls.Clear()
        GameForm.Controls.Add(x)
        GameForm.Show()
    End Sub

    Private Sub BtnMainMenu_Click(sender As Object, e As EventArgs) Handles BtnMainMenu.Click
        Me.Close()
        InitializeComponent()
        Dim x As New Home
        GameForm.Controls.Clear()
        GameForm.Controls.Add(x)
        GameForm.Show()
    End Sub

    Private Sub BtnExit_Click(sender As Object, e As EventArgs) Handles BtnExit.Click
        Application.Exit()
    End Sub
End Class